package ru.papergames.model.binsocket.packets.response
{
	import ru.papergames.model.binsocket.data.ExtByteArray;
	import ru.papergames.model.binsocket.packets.SocketResponse;
	import ru.papergames.model.vo.PositionVO;
	

	public class BattleRemoveBallsInLinesResponse extends SocketResponse
	{		
		public static const NOTIFICATION:String = 'BattleRemoveBallsInLinesResponse';
		
		public var battleOrderId:uint;		
		public var cellsToBeFree:Array;
		
		public function BattleRemoveBallsInLinesResponse(bytes:ExtByteArray)
		{
			super(bytes);
		}
		
		override protected function decode():void {
			
			battleOrderId = binaryData.readUnsignedInt();
						
			var size:uint = binaryData.readUnsignedShort();			
			cellsToBeFree = [];
			
			while (binaryData.bytesAvailable > 0 && size-- > 0) {			
				var pos:PositionVO = new PositionVO( binaryData.readUnsignedShort(), binaryData.readUnsignedShort() );				
				cellsToBeFree.push(pos);
			}
		}
		
		override public function getNotification():String {
			return NOTIFICATION;
		}
	}
}